package com.GUI.lesson01;

import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class TestFlowLayout {
    public static void main(String[] args) {
        Frame frame = new Frame();

        //引入按钮组件
        Button button1 = new Button("button1");
        Button button2 = new Button("按钮2");
        Button button3 = new Button("按钮3");


        //设置为流式布局
        frame.setLayout(new FlowLayout());
        //设置为左
        //frame.setLayout(new FlowLayout(FlowLayout.LEFT));

        frame.setVisible(true);//可见

        //添加按钮
        frame.add(button1);
        frame.add(button2);
        frame.add(button3);

        frame.setSize(200,200);//大小

        //关闭
        frame.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
    }
}
